﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Xml;
using System.Windows;
using System.Collections.ObjectModel;

namespace for7raid.vk
{
    public static class Extensions
    {
        public static string Encode(this string text)
        {
            return text.Replace("&amp;", "&").Replace("&lt;", "<").Replace("&gt;", ">").Replace("&quot;", "\"").Replace("&apos;", "'").Replace("&#39;", "'");

        }

        public static int ParseXmlNodeAsInt(this XmlNode node)
        {
            if (node != null)
                return int.Parse(node.InnerText);
            else
                return 0;
        }

        
    }


    //public static class WindowPositionHelperConfig
    //{
    //    public static void SaveSize(this Window win)
    //    {
    //        Properties.Settings.Default.WindowPosition = win.RestoreBounds;
    //        if (win.SizeToContent == SizeToContent.Manual)
    //            Properties.Settings.Default.WindowSize = win.RestoreBounds;
    //        Properties.Settings.Default.Save();
    //    }

    //    public static void SetSize(this Window win)
    //    {
    //        Rect rect = Properties.Settings.Default.WindowPosition;
    //        Rect rectSize = Properties.Settings.Default.WindowSize;
    //        win.Top = rect.Top;
    //        win.Left = rect.Left;

    //        // Only restore the size for a manually sized
    //        // window.
    //        if (win.SizeToContent == SizeToContent.Manual && rectSize.Width > 0 && rectSize.Height > 0)
    //        {
    //            win.Width = rectSize.Width;
    //            win.Height = rectSize.Height;
    //        }

    //    }
    //}
}
